/**
 * 
 * JShakki  - Dude with recycled paper..
 * 
 * @version 1.0
 * 
 * Copyright (C) 2006 Jarkko Sipilä
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *  
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *  
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * 
 */


package dude.data;

import java.awt.Dimension;

public class Dude {
  
  private DudeDrawable dudeGUI;
  private Board board;
  
  public Dude( DudeDrawable ddb, int boardSize ) {
    this.dudeGUI = ddb;
    this.board = new Board( boardSize, this );
  } 
  
  
  /**
   * 
   * @param boardSize pelilaudan leveys
   * 
   */
  public void newGame( int boardSize ) {
    if( boardSize <= 0 || boardSize > 100 )
      boardSize = Board.DEFAULT_SIZE;
    
    this.board = new Board( boardSize, this );
  }
  
  /**
   * 
   * @param d koordinaatit 
   */
  public void dataSetOwner( Dimension d ) {
    if( d != null )
      this.board.dataSetOwner( d );
  }

  
  
  
  protected void guiDrawLine( Dimension d, int direction ) {
    this.dudeGUI.drawLine(d, direction);
  }
  
  protected void guiDrawOwner( Dimension d, char c ) {	
    if( c == 'x' )
      this.dudeGUI.drawX(d);
    else if( c == 'o' )
      this.dudeGUI.drawO(d);
  }
}
